import Material from "./Material";

class PointMaterial extends Material{
    constructor(param) {
        super(param);
        this.type = 'PointMaterial';

        var VSHADER_SOURCE =

            'precision highp int;\n' +
            'precision highp float;\n' +
            'attribute vec4 a_Position;\n' +
            'uniform float a_Size;\n' +
            'uniform mat4 u_MvMatrix;\n' +
            'uniform mat4 u_PMatrix;\n' +

            'void main() {\n' +
            '  vec4 positionV4 = u_PMatrix * u_MvMatrix * a_Position;\n' +
            '  gl_PointSize = a_Size;\n' +
            '  gl_Position = positionV4;\n' +

            '}\n';

        var FSHADER_SOURCE =
            'precision highp int;\n' +
            'precision highp float;\n' +
            'uniform vec4 u_Color;\n' +

            'void main() {\n' +
            '  vec4 color = u_Color;\n' +
            '  gl_FragColor = color;\n' +
            '}\n';

        this.vshaderSource = VSHADER_SOURCE;
        this.fshaderSource = FSHADER_SOURCE;
    }

}

export default PointMaterial;
